package spring.security.core.jackson;

import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;

public class JsonAnnotationIntrospector extends JacksonAnnotationIntrospector{

	private static final long serialVersionUID = 1L;

	public Object findFilterId(Annotated a) {
		JsonFilter ann = (JsonFilter) this._findAnnotation(a, JsonFilter.class);
		if (ann != null) {
			String id = ann.value();
			if (id.length() > 0) {
				return id + a.getName();
			}
		}

		return null;
	}
	
}
